import React from 'react'
import { NavBar, Tabs } from 'react-vant';
import { useNavigate } from 'react-router-dom'
import axios from 'axios';
const Index: React.FC = () => {
  const navigate = useNavigate()
    let obj={
    id:new Date().getTime().toString(),
    total:1200,
    title:'哈哈',
    des:'20哈' 
  }
    const zf=async()=>{ 
   
      const res=await axios.get('/api/zf',{params:{obj}})
      console.log(res);
      if(res.data.code==200){
      window.open(res.data.url)
    }
    }
  // const items = Array.from({ length: 4 }, (_, i) => i + 1)
  const items = ['待支付', '进行中', '已完成', '已取消','全部'];
  return (
    <div>
      <NavBar
        title="我的订单"
        leftText="返回"
        rightText="信息"
        onClickLeft={() => navigate(-1)}
        onClickRight={() => navigate('xinxi')}
      />
      <div>
        <Tabs type='card'>
          {items.map(item => (
            <Tabs.TabPane key={item} title={`${item}`}>
              {item}
            </Tabs.TabPane>
          ))}
        </Tabs>
      </div>
      <button onClick={zf}>支付</button>
    </div>
  )
}

export default Index